<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <p>{{name}}</p>
    <!-- 不写参数默认执行的时候就会传一个事件对象 -->
    <button @click="fn">点击事件</button>
    <!-- 必须手动传事件对象 -->
    <button @click="fa($event)">点击事件(带括号)</button>
    <button @click.stop="fn">事件修饰符</button>
    <input type="text" @keyup.enter="get" v-model="a">
  </div>
  <script src="https://cdn.jsdelivr.net/npm/vue@2.6.0"></script>
  <script>
    let vm = new Vue({
      el: '#app',
      data: {
        name: 'zf',
        a:1
      },
      methods: {
        fn(e){
          console.log(e.type)
        },
        fa(e){
          console.log(e)
        },
        get(){
          this.a = 1000
          console.log(this)
        }
      }
    })
  </script>
</body>
</html>